<?php
class Merchant_Service_CustomerDepositOrder
{
	 
	public function __construct($options){
		 
	}
	
	
	/**
	* 获取用户Balance信息
	* @param  $customerId
	* @return array 
	*/
	public static function addOrder($row){
		$customerBalance = new Merchant_Model_CustomerDepositOrder();
		$customerBalanceLog = new Merchant_Model_CustomerDepositLog();
		$customerBalance->getAdapter()->beginTransaction();
		 
		try{
			$id = $customerBalance->add($row);
			
			$rowLog = array('cdo_id'=>$id,'customer_id'=>$row['customer_id'],
							'cdo_status'=>$row['cdo_payment_status'],'cdl_note'=>"Order Created",
							'cdl_create_time'=>$row['cdo_create_date']);
			$customerBalanceLog->add($rowLog);
			$customerBalance->getAdapter()->commit();
			return $id;
		} catch (Exception $e) {
					$customerBalance->getAdapter()->rollBack();
					$logger =  Zend_Registry::get('log');
				 
					$logger->info(date('Y-m-d H:i:s').': '.$e->getMessage()." \n");
					return false; 
		}	
		 
	}
	
	public static function getOrder($id){
		$customerDorder = new Merchant_Model_CustomerDepositOrder();
		return $customerDorder->get($id);	
	}
	 

}